home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
maya_miguel_global_groovin.swf
/
scripts
/
frame_11
/
DoAction.as
Wrap
Text File
|
2007-09-27
|
20KB
|
753 lines
function BeforeDrag(whichMC)
{
var _loc1_ = whichMC;
var _loc2_ = _root;
if(!_loc2_.GameStarted)
{
_loc2_.imdragging = true;
_loc2_.whatimdragging = _loc1_;
_loc2_.SwapLayerSymbol.swapDepths(_loc1_);
_loc2_.Item1currentx = _loc1_._x;
_loc2_.Item1currenty = _loc1_._y;
_loc1_.gotoAndStop("drag");
startDrag(_loc1_,1);
}
}
function AfterDrag(whichMC)
{
var _loc1_ = whichMC;
var _loc2_ = _root;
_loc2_.imdragging = false;
_loc2_.whatimdragging = null;
if(!_loc2_.GameStarted)
{
stopDrag();
_loc1_.swapDepths(_loc2_.SwapLayerSymbol);
if(_loc1_._droptarget eq "/soundtrack1/snaplocation1" and _loc2_.CheckAllCollision(_loc1_,1) == 0)
{
_loc1_._y = _loc2_.soundtrack1.snapposition1._y + _loc2_.yoffset1;
_loc2_.Item1currentx = _loc1_._x;
_loc2_.Item1currenty = _loc1_._y;
_loc1_.gotoAndStop("on");
}
else if(_loc1_._droptarget eq "/soundtrack2/snaplocation1" and _loc2_.CheckAllCollision(_loc1_,2) == 0)
{
_loc1_._y = _loc2_.soundtrack2.snapposition1._y + _loc2_.yoffset2;
_loc2_.Item1currentx = _loc1_._x;
_loc2_.Item1currenty = _loc1_._y;
_loc1_.gotoAndStop("on");
}
else if(_loc1_._droptarget eq "/soundtrack3/snaplocation1" and _loc2_.CheckAllCollision(_loc1_,3) == 0)
{
_loc1_._y = _loc2_.soundtrack3.snapposition1._y + _loc2_.yoffset3;
_loc2_.Item1currentx = _loc1_._x;
_loc2_.Item1currenty = _loc1_._y;
_loc1_.gotoAndStop("on");
}
else if(_loc2_.Item1currenty > _loc2_.ybaseline and _loc1_._y < _loc2_.ybaseline)
{
_loc1_.gotoAndStop("off");
if(_loc1_._name.indexOf("sound1") == 0)
{
_loc1_._x = _loc2_.s1x;
_loc1_._y = _loc2_.s1y;
}
if(_loc1_._name.indexOf("sound2") == 0)
{
_loc1_._x = _loc2_.s2x;
_loc1_._y = _loc2_.s2y;
}
if(_loc1_._name.indexOf("sound3") == 0)
{
_loc1_._x = _loc2_.s3x;
_loc1_._y = _loc2_.s3y;
}
if(_loc1_._name.indexOf("sound4") == 0)
{
_loc1_._x = _loc2_.s4x;
_loc1_._y = _loc2_.s4y;
}
if(_loc1_._name.indexOf("sound5") == 0)
{
_loc1_._x = _loc2_.s5x;
_loc1_._y = _loc2_.s5y;
}
if(_loc1_._name.indexOf("sound6") == 0)
{
_loc1_._x = _loc2_.s6x;
_loc1_._y = _loc2_.s6y;
}
if(_loc1_._name.indexOf("sound7") == 0)
{
_loc1_._x = _loc2_.s7x;
_loc1_._y = _loc2_.s7y;
}
if(_loc1_._name.indexOf("sound8") == 0)
{
_loc1_._x = _loc2_.s8x;
_loc1_._y = _loc2_.s8y;
}
if(_loc1_._name.indexOf("sound9") == 0)
{
_loc1_._x = _loc2_.s9x;
_loc1_._y = _loc2_.s9y;
}
if(_loc1_._name.indexOf("beat1") == 0)
{
_loc1_._x = _loc2_.b1x;
_loc1_._y = _loc2_.b1y;
}
if(_loc1_._name.indexOf("beat2") == 0)
{
_loc1_._x = _loc2_.b2x;
_loc1_._y = _loc2_.b2y;
}
if(_loc1_._name.indexOf("beat3") == 0)
{
_loc1_._x = _loc2_.b3x;
_loc1_._y = _loc2_.b3y;
}
if(_loc1_._name.indexOf("beat4") == 0)
{
_loc1_._x = _loc2_.b4x;
_loc1_._y = _loc2_.b4y;
}
if(_loc1_._name.indexOf("xstop") == 0)
{
_loc1_._x = _loc2_.xstopx;
_loc1_._y = _loc2_.xstopy;
}
if(_loc1_._name eq soundtrack1current + "_" + soundtrack1index)
{
_loc2_.TerminateThisSound2(_loc2_.soundtrack1current,_loc2_.soundtrack1index,1);
_loc2_.soundtrack1current = "";
_loc2_.soundtrack1index = 0;
_loc2_.soundtrack1playing = false;
}
if(_loc1_._name eq soundtrack2current + "_" + soundtrack2index)
{
_loc2_.TerminateThisSound2(_loc2_.soundtrack2current,_loc2_.soundtrack2index,2);
_loc2_.soundtrack2current = "";
_loc2_.soundtrack2index = 0;
_loc2_.soundtrack2playing = false;
}
if(_loc1_._name eq soundtrack3current + "_" + soundtrack3index)
{
_loc2_.TerminateThisSound2(_loc2_.soundtrack3current,_loc2_.soundtrack3index,3);
_loc2_.soundtrack3current = "";
_loc2_.soundtrack3index = 0;
_loc2_.soundtrack3playing = false;
}
}
else
{
_loc1_._x = _loc2_.Item1currentx;
_loc1_._y = _loc2_.Item1currenty;
if(_loc1_._y <= _loc2_.ybaseline)
{
_loc1_.gotoAndStop("off");
}
else
{
_loc1_.gotoAndStop("on");
}
}
}
}
function DetectCollision(whichMC, whichSoundByte)
{
var result = 0;
i = 1;
while(i <= _root.ButtonCount)
{
temp = whichMC.hitTest(eval("_root." + whichSoundByte + "_" + i));
if(temp)
{
return i;
}
i++;
}
return result;
}
function DetectCollisionTwo(whichMC, whichSoundByte)
{
var result = 0;
i = 1;
while(i <= _root.ButtonCount)
{
if(whichMC._name ne whichSoundByte + "_" + i)
{
temp = whichMC.hitTest(eval("_root." + whichSoundByte + "_" + i));
if(temp)
{
result = i;
}
}
i++;
}
return result;
}
function CheckAllCollision(whichMC, whichTrack)
{
var result = 0;
var temp;
var i;
i = 1;
while(i <= _root.TotalSounds)
{
temp1 = "sound" + i;
temp = _root.DetectCollisionTwo(whichMC,temp1);
if(temp > 0 and whichMC._name ne temp1 + "_" + temp)
{
result += 1;
}
i++;
}
i = 1;
while(i <= _root.TotalBeats)
{
temp1 = "beat" + i;
temp = _root.DetectCollisionTwo(whichMC,temp1);
if(temp > 0 and whichMC._name ne temp1 + "_" + temp)
{
result += 1;
}
i++;
}
temp1 = "xstop";
temp = _root.DetectCollisionTwo(whichMC,temp1);
if(temp > 0 and whichMC._name ne temp1 + "_" + temp)
{
result += 1;
}
temp1 = "soundtrack" + whichTrack + ".endpoint";
if(whichMC.hitTest(eval(temp1)) > 0)
{
result += 1;
}
temp1 = "soundtrack" + whichTrack + ".startpoint";
if(whichMC.hitTest(eval(temp1)) > 0)
{
result += 1;
}
return result;
}
function TerminateThisSound(whichSound, whichInstance, whichTrack)
{
_root.turnSoundClipOff(whichSound,whichTrack);
tellTarget("_root." + whichSound + "_" + whichInstance)
{
gotoAndStop("on");
amiplaying = false;
}
}
function TerminateThisSound2(whichSound, whichInstance, whichTrack)
{
_root.turnSoundClipOff(whichSound,whichTrack);
tellTarget("_root." + whichSound + "_" + whichInstance)
{
gotoAndStop("off");
amiplaying = false;
}
}
function StopThisSound(whichSound, whichInstance)
{
_root.turnSoundClipOff(whichSound,whichTrack);
tellTarget("_root." + whichSound + "_" + whichInstance)
{
stop();
}
}
function StartThisSound(whichSound, whichInstance, offSet, whichTrack)
{
_root.turnSoundClipOn(whichSound,whichInstance,offSet,whichTrack);
tellTarget("_root." + whichSound + "_" + whichInstance)
{
amiplaying = true;
play();
}
}
function SoundTest(whichTrack, whichPlayHead, whichSound)
{
var result = false;
collisionItem = _root.DetectCollision(whichPlayHead,whichSound);
if(collisionItem gt 0)
{
switch(whichTrack)
{
case 1:
if(eval("_root." + _root.soundtrack1current + "_" + _root.soundtrack1index + ".iloop") and _root.soundtrack1current != whichSound)
{
_root.TerminateThisSound(_root.soundtrack1current,_root.soundtrack1index,whichTrack);
_root.soundtrack1current = whichSound;
_root.soundtrack1index = collisionItem;
_root.soundtrack1playing = false;
}
break;
case 2:
if(eval("_root." + _root.soundtrack2current + "_" + _root.soundtrack2index + ".iloop") and _root.soundtrack2current != whichSound)
{
_root.TerminateThisSound(_root.soundtrack2current,_root.soundtrack2index,whichTrack);
_root.soundtrack2current = whichSound;
_root.soundtrack2index = collisionItem;
_root.soundtrack2playing = false;
}
break;
case 3:
if(eval("_root." + _root.soundtrack3current + "_" + _root.soundtrack3index + ".iloop") and _root.soundtrack3current != whichSound)
{
_root.TerminateThisSound(_root.soundtrack3current,_root.soundtrack3index,whichTrack);
_root.soundtrack3current = whichSound;
_root.soundtrack3index = collisionItem;
_root.soundtrack3playing = false;
}
}
result = true;
if(!eval("_root.soundtrack" + whichTrack + "playing"))
{
switch(whichTrack)
{
case 1:
_root.soundtrack1playing = true;
_root.soundtrack1index = collisionItem;
_root.soundtrack1current = whichSound;
break;
case 2:
_root.soundtrack2playing = true;
_root.soundtrack2index = collisionItem;
_root.soundtrack2current = whichSound;
break;
case 3:
_root.soundtrack3playing = true;
_root.soundtrack3index = collisionItem;
_root.soundtrack3current = whichSound;
}
_root.StartThisSound(whichSound,collisionItem,0,whichTrack);
}
}
else
{
result = false;
}
return result;
}
function SwitchLanguage(whichLanguage, whichAudio)
{
var temp;
if(whichLanguage eq "english")
{
temp = "off";
}
else
{
temp = "espanol";
}
i = 1;
while(i <= _root.ButtonCount)
{
if(eval("_root." + whichAudio + "_" + i + "._y") < _root.ybaseline)
{
tellTarget("_root." + whichAudio + "_" + i)
{
gotoAndStop(temp);
}
}
i++;
}
}
function ChangeLanguage(whichLanguage)
{
var _loc1_ = _root;
var _loc2_ = whichLanguage;
_loc1_.SwitchLanguage(_loc2_,"sound1");
_loc1_.SwitchLanguage(_loc2_,"sound2");
_loc1_.SwitchLanguage(_loc2_,"sound3");
_loc1_.SwitchLanguage(_loc2_,"sound4");
_loc1_.SwitchLanguage(_loc2_,"sound5");
_loc1_.SwitchLanguage(_loc2_,"sound6");
_loc1_.SwitchLanguage(_loc2_,"sound7");
_loc1_.SwitchLanguage(_loc2_,"sound8");
_loc1_.SwitchLanguage(_loc2_,"sound9");
_loc1_.SwitchLanguage(_loc2_,"beat1");
_loc1_.SwitchLanguage(_loc2_,"beat2");
_loc1_.SwitchLanguage(_loc2_,"beat3");
_loc1_.SwitchLanguage(_loc2_,"beat4");
_loc1_.SwitchLanguage(_loc2_,"xstop");
_loc1_.dynamictext.gotoAndStop(_loc2_);
}
function RecordStartingLocation()
{
var _loc1_ = _root;
_loc1_.s1x = _loc1_.sound1_1._x;
_loc1_.s1y = _loc1_.sound1_1._y;
_loc1_.s2x = _loc1_.sound2_1._x;
_loc1_.s2y = _loc1_.sound2_1._y;
_loc1_.s3x = _loc1_.sound3_1._x;
_loc1_.s3y = _loc1_.sound3_1._y;
_loc1_.s4x = _loc1_.sound4_1._x;
_loc1_.s4y = _loc1_.sound4_1._y;
_loc1_.s5x = _loc1_.sound5_1._x;
_loc1_.s5y = _loc1_.sound5_1._y;
_loc1_.s6x = _loc1_.sound6_1._x;
_loc1_.s6y = _loc1_.sound6_1._y;
_loc1_.s7x = _loc1_.sound7_1._x;
_loc1_.s7y = _loc1_.sound7_1._y;
_loc1_.s8x = _loc1_.sound8_1._x;
_loc1_.s8y = _loc1_.sound8_1._y;
_loc1_.s9x = _loc1_.sound9_1._x;
_loc1_.s9y = _loc1_.sound9_1._y;
_loc1_.b1x = _loc1_.beat1_1._x;
_loc1_.b1y = _loc1_.beat1_1._y;
_loc1_.b2x = _loc1_.beat2_1._x;
_loc1_.b2y = _loc1_.beat2_1._y;
_loc1_.b3x = _loc1_.beat3_1._x;
_loc1_.b3y = _loc1_.beat3_1._y;
_loc1_.b4x = _loc1_.beat4_1._x;
_loc1_.b4y = _loc1_.beat4_1._y;
_loc1_.xstopx = _loc1_.xstop_1._x;
_loc1_.xstopy = _loc1_.xstop_1._y;
}
function turnOffDemoSound()
{
var _loc1_ = _root;
if(_loc1_.demosound eq "sound1demo")
{
_loc1_.sound1clip.stop();
}
if(_loc1_.demosound eq "sound2demo")
{
_loc1_.sound2clip.stop();
}
if(_loc1_.demosound eq "sound3demo")
{
_loc1_.sound3clip.stop();
}
if(_loc1_.demosound eq "sound4demo")
{
_loc1_.sound4clip.stop();
}
if(_loc1_.demosound eq "sound5demo")
{
_loc1_.sound5clip_1.stop();
}
if(_loc1_.demosound eq "sound6demo")
{
_loc1_.sound6clip_1.stop();
}
if(_loc1_.demosound eq "sound7demo")
{
_loc1_.sound7clip_1.stop();
}
if(_loc1_.demosound eq "sound8demo")
{
_loc1_.sound8clip.stop();
}
if(_loc1_.demosound eq "sound9demo")
{
_loc1_.sound9clip_1.stop();
}
if(_loc1_.demosound eq "beat1demo")
{
_loc1_.beat1clip_1.stop();
}
if(_loc1_.demosound eq "beat2demo")
{
_loc1_.beat2clip_1.stop();
}
if(_loc1_.demosound eq "beat3demo")
{
_loc1_.beat3clip_1.stop();
}
if(_loc1_.demosound eq "beat4demo")
{
_loc1_.beat4clip_1.stop();
}
}
function turnSoundClipOn(whichSound, whichInstance, Offset, whichTrack)
{
var _loc1_ = _root;
var _loc2_ = Offset;
var _loc3_ = whichSound;
if(_loc3_ eq "sound1")
{
_loc1_.sound1clip.start(_loc2_);
}
if(_loc3_ eq "sound2")
{
_loc1_.sound2clip.start(_loc2_);
}
if(_loc3_ eq "sound3")
{
_loc1_.sound3clip.start(_loc2_);
}
if(_loc3_ eq "sound4")
{
_loc1_.sound4clip.start(_loc2_);
}
if(_loc3_ eq "sound5")
{
switch(whichTrack)
{
case 1:
_loc1_.sound5clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.sound5clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.sound5clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "sound6")
{
switch(whichTrack)
{
case 1:
_loc1_.sound6clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.sound6clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.sound6clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "sound7")
{
switch(whichTrack)
{
case 1:
_loc1_.sound7clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.sound7clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.sound7clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "sound8")
{
_loc1_.sound8clip.start(_loc2_);
}
if(_loc3_ eq "sound9")
{
switch(whichTrack)
{
case 1:
_loc1_.sound9clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.sound9clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.sound9clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "beat1")
{
switch(whichTrack)
{
case 1:
_loc1_.beat1clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.beat1clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.beat1clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "beat2")
{
switch(whichTrack)
{
case 1:
_loc1_.beat2clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.beat2clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.beat2clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "beat3")
{
switch(whichTrack)
{
case 1:
_loc1_.beat3clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.beat3clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.beat3clip_3.start(_loc2_,20);
}
}
if(_loc3_ eq "beat4")
{
switch(whichTrack)
{
case 1:
_loc1_.beat4clip_1.start(_loc2_,20);
break;
case 2:
_loc1_.beat4clip_2.start(_loc2_,20);
break;
case 3:
_loc1_.beat4clip_3.start(_loc2_,20);
}
}
}
function turnSoundClipOff(whichSound, whichTrack)
{
var _loc1_ = _root;
var _loc2_ = whichSound;
var _loc3_ = whichTrack;
if(_loc2_ eq "sound1")
{
_loc1_.sound1clip.stop("elephant");
}
if(_loc2_ eq "sound2")
{
_loc1_.sound2clip.stop("train");
}
if(_loc2_ eq "sound3")
{
_loc1_.sound3clip.stop("tincan");
}
if(_loc2_ eq "sound4")
{
_loc1_.sound4clip.stop("water");
}
if(_loc2_ eq "sound5")
{
switch(_loc3_)
{
case 1:
_loc1_.sound5clip_1.stop("xylo");
break;
case 2:
_loc1_.sound5clip_2.stop("xylo");
break;
case 3:
_loc1_.sound5clip_3.stop("xylo");
}
}
if(_loc2_ eq "sound6")
{
switch(_loc3_)
{
case 1:
_loc1_.sound6clip_1.stop("bouzouki");
break;
case 2:
_loc1_.sound6clip_2.stop("bouzouki");
break;
case 3:
_loc1_.sound6clip_3.stop("bouzouki");
}
}
if(_loc2_ eq "sound7")
{
switch(_loc3_)
{
case 1:
_loc1_.sound7clip_1.stop("bagpipes");
break;
case 2:
_loc1_.sound7clip_2.stop("bagpipes");
break;
case 3:
_loc1_.sound7clip_3.stop("bagpipes");
}
}
if(_loc2_ eq "sound8")
{
_loc1_.sound8clip.stop("gong");
}
if(_loc2_ eq "sound9")
{
switch(_loc3_)
{
case 1:
_loc1_.sound9clip_1.stop("maracas");
break;
case 2:
_loc1_.sound9clip_2.stop("maracas");
break;
case 3:
_loc1_.sound9clip_3.stop("maracas");
}
}
if(_loc2_ eq "beat1")
{
switch(_loc3_)
{
case 1:
_loc1_.beat1clip_1.stop("mideast");
break;
case 2:
_loc1_.beat1clip_2.stop("mideast");
break;
case 3:
_loc1_.beat1clip_3.stop("mideast");
}
}
if(_loc2_ eq "beat2")
{
switch(_loc3_)
{
case 1:
_loc1_.beat2clip_1.stop("african");
break;
case 2:
_loc1_.beat2clip_2.stop("african");
break;
case 3:
_loc1_.beat2clip_3.stop("african");
}
}
if(_loc2_ eq "beat3")
{
switch(_loc3_)
{
case 1:
_loc1_.beat3clip_1.stop("chinese");
break;
case 2:
_loc1_.beat3clip_2.stop("chinese");
break;
case 3:
_loc1_.beat3clip_3.stop("chinese");
}
}
if(_loc2_ eq "beat4")
{
switch(_loc3_)
{
case 1:
_loc1_.beat4clip_1.stop("brazillian");
break;
case 2:
_loc1_.beat4clip_2.stop("brazillian");
break;
case 3:
_loc1_.beat4clip_3.stop("brazillian");
}
}
}
_root.dynamictext.gotoAndStop(_root.language);
_root.GameStarted = false;
_root.GamePaused = false;
_root.soundtrack1playing = false;
_root.soundtrack2playing = false;
_root.soundtrack3playing = false;
_root.demosound = "";
_root.imdragging = false;
_root.track1offset = 0;
_root.track2offset = 0;
_root.track3offset = 0;